package pe.edu.upc.e41a.javasoft.daoImpl;


import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import pe.edu.upc.e41a.javasoft.dao.ImagenDao;
import pe.edu.upc.e41a.javasoft.domain.Imagen;

@Repository(value = "ImagenDao")
public class ImagenDaoImpl implements ImagenDao {

	private static final Log log = LogFactory.getLog(ImagenDaoImpl.class);

	@PersistenceContext
	transient EntityManager em;

	public final EntityManager entityManager() {
		EntityManager entityManager = em;
		if (entityManager == null)
			throw new IllegalStateException(
					"Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
		return entityManager;
	}	

	@Transactional	
	@Override
	public void saveImagen(Imagen Imagen) {
		// TODO Auto-generated method stub
		if (em == null)
			this.em = this.em;
		em.persist(Imagen);
		
	}

	@Override
	public void updateImagen(Imagen Imagen) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void deleteImagen(Imagen Imagen) {
		// TODO Auto-generated method stub
		
	}

}
